import dd.ding.config.SpringConfig;
import dd.ding.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        //创建spring容器   这是通过配置文件来创建
//        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        //这是通过注解创建spring容器
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);

        System.out.println("初始化spring容器");

        //获取UserService服务
        UserService userService = context.getBean(UserService.class);
        //调用接口
        userService.getList();
    }
}
